package org.example.chapter.dao;

import org.example.chapter.emity.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Repository;

@Repository
public class UserDao {

    @Autowired
     JdbcTemplate jdbcTemplate;


    public  User getUserByName(String username){
        String sql="select * from user where username=?";
        return jdbcTemplate.queryForObject(sql,new BeanPropertyRowMapper<User>(User.class),username);

    }
}
